Skip to content

Start & update process bots keyword#3421

Merged
GuillaumeDSM merged 2 commits intodevfrom
start_bots
May 2, 2026
Merged

Start & update process bots keyword#3421
GuillaumeDSM merged 2 commits intodevfrom
start_bots

Conversation

@GuillaumeDSM
Copy link
Copy Markdown
Member

requires #3420

@GuillaumeDSM GuillaumeDSM self-assigned this Apr 26, 2026
@GuillaumeDSM GuillaumeDSM force-pushed the start_bots branch 14 times, most recently from 3aeb49a to 090b180 Compare April 29, 2026 12:33
@GuillaumeDSM GuillaumeDSM changed the title WIP Start bots keyword Start & update process bots keyword Apr 29, 2026
@GuillaumeDSM GuillaumeDSM marked this pull request as ready for review April 29, 2026 12:40
@GuillaumeDSM GuillaumeDSM requested a review from Herklos as a code owner April 29, 2026 12:40
@GuillaumeDSM GuillaumeDSM force-pushed the start_bots branch 3 times, most recently from f78183a to f8002e4 Compare April 29, 2026 15:01
@GuillaumeDSM GuillaumeDSM force-pushed the start_bots branch 4 times, most recently from a305f78 to cc89815 Compare May 1, 2026 07:56
Copy link
Copy Markdown
Contributor

@Herklos Herklos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome tests !!! Great job 💯

Comment thread octobot/constants.py Outdated
Comment on lines +206 to +208
# Web automation: child process sets OCTOBOT_WEB_API_KEY
ENV_WEB_API_KEY = "OCTOBOT_WEB_API_KEY"
WEB_API_KEY_HEADER = "X-Octobot-Api-Key"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, indeed, I'll remove it !

Comment thread octobot/octobot.py Outdated
Comment on lines +108 to +110
# optional path for periodic ProcessBotState JSON (see cli --dump-state)
self.dump_state_path = None
self._process_bot_state_dump_task = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be moved inside taskManager?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea 👍

@staticmethod
def reject_user_path_segment(path_value: str) -> None:
"""Reject obvious path traversal in user-supplied relative paths."""
if ".." in pathlib.PurePath(path_value).parts:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +116 to +124
def _tcp_port_is_free(bind_host: str, port: int) -> bool:
"""True if nothing is currently bound to (host, port) for TCP."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
sock.bind((bind_host, port))
except OSError:
return False
return True
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we create an util method in commons.os_util and use it here?

Comment on lines +138 to +146
for offset_from_base in range(max_offset):
listen_port = listen_port_base + offset_from_base
if blocklist and listen_port in blocklist:
continue
if not ProcessBoundOperatorMixin._tcp_port_is_free(
bind_host_for_probe, listen_port
):
continue
return listen_port
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same (commons.os_util) as previous comment

50200,
blocklist=[50200],
)
assert listen_port == 50201
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍



@dataclasses.dataclass
class ProcessBotState(octobot_commons.dataclasses.MinimizableDataclass):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be placed in commons as it is also used by "octobot" package?

@@ -0,0 +1 @@
# Subpackage for octobot_process functional tests.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +278 to +302
if run_action_details is not None:
inner_after = octobot_process_functional_shared._recall_inner_from_dsl_action(
run_action_details
)
if eae_dict is not None:
exchange_account_after = (
exchange_account_elements_import.ExchangeAccountElements.from_dict(eae_dict)
)
last_six_count = len(exchange_account_after.orders.open_orders)
if last_six_count >= 6:
break
await asyncio.sleep(octobot_process_functional_shared.GRID_ORDERS_POLL_SEC)
else:
pytest.fail(
f"Timed out waiting for six open orders after config refresh "
f"(last count={last_six_count})"
)
assert exchange_account_after is not None
assert inner_after is not None
_assert_three_by_three_grid_ladder_orders(
exchange_account_after.orders.open_orders,
)

# After refresh, expect a new managed child PID (extra spawn in step 5).
refreshed_pid = int(inner_after["pid"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great test 👌

Comment on lines +392 to +394
"run_octobot_process(user_folder='bots/b1', profile_data={...}, "
"exchange_auth_data=[{'internal_name': 'binance', 'api_key': '...', 'api_secret': '...'}], "
"last_execution_result=None)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@GuillaumeDSM
Copy link
Copy Markdown
Member Author

PR is up !

Copy link
Copy Markdown
Contributor

@Herklos Herklos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great features !!

@GuillaumeDSM GuillaumeDSM merged commit ea06925 into dev May 2, 2026
22 checks passed
@GuillaumeDSM GuillaumeDSM deleted the start_bots branch May 2, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants